import { NextResponse } from "next/server"; import { listDays } from "@/lib/storage"; export async function GET(request, ctx) { const { branch, year, month } = await ctx.params; console.log("[/api/branches/[branch]/[year]/[month]/days] params:", { branch, year, month, }); if (!branch || !year || !month) { return NextResponse.json( { error: "branch, year oder month fehlt" }, { status: 400 } ); } try { const days = await listDays(branch, year, month); return NextResponse.json({ branch, year, month, days }); } catch (error) { console.error( "[/api/branches/[branch]/[year]/[month]/days] Fehler:", error ); return NextResponse.json( { error: "Fehler beim Lesen der Tage: " + error.message }, { status: 500 } ); } }